<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">
    <title>学生管理系统</title>
    <!-- Bootstrap core CSS -->
    <link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="/public/css/main.css" rel="stylesheet">
</head>

<body>
<div class="container-fluid">
    <div class="navbar-header">
        <a class="navbar-brand" href="www.baidu.com">学生管理系统</a>
    </div>
    <div class="row">
    </div>
    <div class="col-sm-9 col-sm-offset-3 col-md-12 col-md-offset-2 main">
        <h1 class="page-header">Top1</h1>
        <div class="row placeholders">
            {{ each top }}
            <div class="col-xs-6 col-sm-4 placeholder">
                <img src="/public/img/bg.jpg"
                     width="200" height="200" class="img-responsive" alt="Generic placeholder thumbnail">
                <h4>{{ $value.name }}</h4>
                <span class="text-muted">{{ $value.hobbies }}</span>
            </div>
            {{ /each }}
        </div>
        <h2 class="sub-header">学生列表</h2>
        <form class="form-inline" action="/students">
            <div class="form-group">
                <label for="id" style="margin:5px">搜索:</label>
                <input type="text" style="margin:5px ;width: 400px" class="form-control" name="name" id="id"
                       placeholder="请输入姓名">
            </div>
            <div class="form-inline">
                <button type="submit" class="btn btn-default" style="width: 100px ;margin:5px">搜索</button>
                <a class="btn btn-success" href="/students/new">添加学生</a>
            </div>
        </form>
        <div class="table-responsive" style="margin-top: 50px">
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>#</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>爱好</th>
                    <th>照片</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {{if count == 0}}
                    <tr>
                    </tr>
                    <td>
                        未找到该姓名,请重新查询!
                    </td>
                    </tbody>
                {{else}}
                    {{each students}}
                    <tr>
                        <td>{{ $index +1 }}</td>
                        <td>{{ $value.name }}</td>
                        {{if $value.gender==0 }}
                        <td>男</td>
                        {{else}}
                        <td>女</td>
                        {{/if}}
                        <td> {{ $value.age }}</td>
                        <td>{{ $value.hobbies }}</td>
                        <td>{{ $value.image }}</td>
                        <td>
                            <a href="/students/edit?id={{ $value.id }}">编辑</a>
                            <a href="javascript:if(confirm('确实要删除?'))location='/students/delete?id={{ $value.id }}'">删除</a>
                        </td>
                    </tr>
                    {{ /each }}
                {{/if}}


                </tbody>
            </table>
        </div>
    </div>
</div>
</div>
</body>

</html>
